namespace Terra.Core.Common.ErrorCodes.Constants;

using Terra.Core.Common.ErrorCodes.Attributes;
using Terra.Core.Common.ErrorCodes.Models;

/// <summary>
/// API错误码
/// </summary>
public static class ApiErrorCodes
{
    /// <summary>
    /// API版本不支持
    /// </summary>
    [ErrorCode("API001", "不支持的API版本: {0}", Severity = ErrorSeverity.Error)]
    public const string UnsupportedVersion = "API001";

    /// <summary>
    /// API已弃用
    /// </summary>
    [ErrorCode("API002", "该API已弃用，请使用新版本: {0}", Severity = ErrorSeverity.Warning)]
    public const string Deprecated = "API002";

    /// <summary>
    /// 请求方法不支持
    /// </summary>
    [ErrorCode("API003", "不支持的HTTP方法: {0}", Severity = ErrorSeverity.Error)]
    public const string MethodNotAllowed = "API003";

    /// <summary>
    /// 媒体类型不支持
    /// </summary>
    [ErrorCode("API004", "不支持的媒体类型: {0}", Severity = ErrorSeverity.Error)]
    public const string UnsupportedMediaType = "API004";

    /// <summary>
    /// 接口调用频率超限
    /// </summary>
    [ErrorCode("API005", "接口调用过于频繁，请 {0} 秒后重试", Severity = ErrorSeverity.Error)]
    public const string RateLimitExceeded = "API005";

    /// <summary>
    /// API未找到
    /// </summary>
    [ErrorCode("API006", "API未找到: {0}", Severity = ErrorSeverity.Error)]
    public const string NotFound = "API006";

    /// <summary>
    /// 请求超时
    /// </summary>
    [ErrorCode("API007", "请求超时", Severity = ErrorSeverity.Error)]
    public const string RequestTimeout = "API007";

    /// <summary>
    /// 响应格式错误
    /// </summary>
    [ErrorCode("API008", "响应格式错误: {0}", Severity = ErrorSeverity.Error)]
    public const string InvalidResponseFormat = "API008";

    /// <summary>
    /// 请求参数无效
    /// </summary>
    [ErrorCode("API009", "请求参数无效: {0}", Severity = ErrorSeverity.Error)]
    public const string InvalidParameter = "API009";

    /// <summary>
    /// 服务不可用
    /// </summary>
    [ErrorCode("API010", "服务暂时不可用，请稍后重试", Severity = ErrorSeverity.Error)]
    public const string ServiceUnavailable = "API010";

    /// <summary>
    /// 第三方服务调用失败
    /// </summary>
    [ErrorCode("API011", "第三方服务调用失败: {0}", Severity = ErrorSeverity.Error)]
    public const string ThirdPartyServiceError = "API011";

    /// <summary>
    /// API密钥无效
    /// </summary>
    [ErrorCode("API012", "无效的API密钥", Severity = ErrorSeverity.Error)]
    public const string InvalidApiKey = "API012";
}